package com.cluster.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by oracle on 2017-06-27.
 */
@Controller
public class RedisClusterTest {

    @Autowired
    RedisTemplate redisTemplate;
    @RequestMapping("/redisSave")
    @ResponseBody
    public String redisSave() {
        String key="redisTestKey";
        redisTemplate.boundValueOps(key).set("poooooooooooooooooooo");
        return "success";
    }

    @RequestMapping("/getRedisCache")
    @ResponseBody
    public Object getMessage(){
        String key="redisTestKey";
       return redisTemplate.boundValueOps(key).get();
    }
}
